var type="";
	var price=0.0;
	var price2=999999.0;
	var pin="";
	var time="";	
	var status="";
	var currpage=1;
	var pagesize=4;
$(document).ready(function() {
	$("#zc-tel").mouseenter(function() {
		$("#zc_ga").css({
			"display": "block",
			"z-index": "999"
		});
	}).mouseleave(function() {
		$("#zc_ga").css("display", "none");
	});

	var i=0;
	var id="";
	$(".choose_ul input.ipcity").focus(function() {
		$(this).addClass("iptseupcur");
		id = $(this).attr("id");
		if(id=="fromCity"){
			$("#city1").css("display","block");
			if(i==1){
				$("#city1").css({"display":"block","top":"45px"});
			}
		}else{
			$("#city1").css({"display":"block","top":"100px"});
			i=1;
		}
	}).blur(function() {
		$(this).removeClass("iptseupcur");	
		$("#city1").css("display","none");
	});
	
	$("#city option").mousedown(function(){
		var val = $(this).text();
		if(id=="fromCity"){
			$("#fromCity").val(val);
			$("#fromCity").text(val);
		
		}else{
			$("#toCity").val(val);
			$("#toCity").text(val);
		}
		
	});
	
	$("#song").click(function() {
		var x = $(this).css("background-position-x");
		if (x == ("-228px")) {
			$(this).css("background-position-x", "-175px");
			$("#shang").css("background-position-x", "-228px");
			$("input[name=kind]").val("到店取还");
		} else {
			$("#shang").css("background-position-x", "-175px");
			$(this).css("background-position-x", "-228px");
			$("input[name=kind]").val("上门取还");
		}
	});

	$("#shang").click(function() {
		var x = $(this).css("background-position-x");
		if (x == ("-228px")) {
			$(this).css("background-position-x", "-175px");
			$("#song").css("background-position-x", "-228px");
			$("input[name=kind]").val("上门取还");
		} else {
			$("#song").css("background-position-x", "-175px");
			$(this).css("background-position-x", "-228px");
			$("input[name=kind]").val("到店取还");
		}
	});
	
	$(".cardate  input.iptdate").focus(function() {
		$(this).addClass("iptseupcurday");
	}).blur(function() {
		$(this).removeClass("iptseupcurday");
	});

	var id = "";
	$(".cartime input.ipttime").click(function() {
		id = $(this).attr("id");
		$(id).addClass("iptseupcur");
		if (id == "fromHourMinute") {
			$(".sz_time").css("display", "block");
		} else {
			$(".sz-timex").css("display", "block");
		}

	}).blur(function() {
		$(this).removeClass("iptseupcur");
		if (id == "fromHourMinute") {
			$(".sz_time").css("display", "none");
		} else {
			$(".sz-timex").css("display", "none");
		}
	});

	$("#fromTime ul li").mousedown(function(){
		var val = $(this).text();
			$("#fromHourMinute").val(val);
			$("#fromHourMinute").text(val);
		
	});
	
	$("#toTime ul li").mousedown(function(){
		var val = $(this).text();
		
			$("#toHourMinute").val(val);
			$("#toHourMinute").text(val);
		
	});
	
});

function che(che) {
	var num = $(che).index();
	$(this).addClass("checked");
	switch (num) {
		case 0:
			$(".zj_cx_bx").css("background-position-y", "-41px");
			$(".zj_cx_sdjc").css("background-position-y", "-14px");
			$(".zj_cx_jj").css("background-position-y", "-14px");
			$(".zj_cx_sw").css("background-position-y", "-14px");
			$(".zj_cx_hh").css("background-position-y", "-14px");
			$(".zj_cx_suv").css("background-position-y", "-14px");
			$(".zj_cx_zsw").css("background-position-y", "-14px");
			$(".zj_cx_gx").css("background-position-y", "-14px");
			$(".zj_cx_dd").css("background-position-y", "-14px");
			$(".checked i.cartxt").css("color", "#93939e");
			$(".pointer .cartxt").css("color", "#93939e");
			$(".check i.cartxt").css("color","#fabe00");
			$(".checked").removeClass("checked");
			type="";
			break;
		case 1:
			$(".zj_cx_sdjc").css("background-position-y", "-41px");
			$(".zj_cx_bx").css("background-position-y", "-14px");
			$(".zj_cx_sw").css("background-position-y", "-14px");
			$(".zj_cx_hh").css("background-position-y", "-14px");
			$(".zj_cx_suv").css("background-position-y", "-14px");
			$(".zj_cx_zsw").css("background-position-y", "-14px");
			$(".zj_cx_gx").css("background-position-y", "-14px");
			$(".zj_cx_dd").css("background-position-y", "-14px");
			$(".check i.cartxt").css("color", "#93939e");
			$(".pointer .cartxt").css("color", "#93939e");
			$(".zj_cx_sdjc").next().css("color", "#fabe00");
			type="手动紧凑型";
			break;
		case 2:
			$(".zj_cx_jj").css("background-position-y", "-41px");
			$(".zj_cx_bx").css("background-position-y", "-14px");
			$(".zj_cx_sdjc").css("background-position-y", "-14px");
			$(".zj_cx_sw").css("background-position-y", "-14px");
			$(".zj_cx_hh").css("background-position-y", "-14px");
			$(".zj_cx_suv").css("background-position-y", "-14px");
			$(".zj_cx_zsw").css("background-position-y", "-14px");
			$(".zj_cx_gx").css("background-position-y", "-14px");
			$(".zj_cx_dd").css("background-position-y", "-14px");
			$(".pointer i.cartxt").css("color", "#93939e");
			$(".check i.cartxt").css("color", "#93939e");
			$(".zj_cx_jj").next().css("color", "#fabe00");
			type="经济型";
			break;
		case 3:
			$(".zj_cx_sw").css("background-position-y", "-41px");
			$(".zj_cx_bx").css("background-position-y", "-14px");
			$(".zj_cx_hh").css("background-position-y", "-14px");
			$(".zj_cx_suv").css("background-position-y", "-14px");
			$(".zj_cx_zsw").css("background-position-y", "-14px");
			$(".zj_cx_gx").css("background-position-y", "-14px");
			$(".zj_cx_dd").css("background-position-y", "-14px");
			$(".zj_cx_sdjc").css("background-position-y", "-14px");
			$(".zj_cx_jj").css("background-position-y", "-14px");
			$(".pointer i.cartxt").css("color", "#93939e");
			$(".check i.cartxt").css("color", "#93939e");
			$(".zj_cx_sw").next().css("color", "#fabe00");
			type="商务型";
			break;
		case 4:
			$(".zj_cx_hh").css("background-position-y", "-41px");
			$(".zj_cx_bx").css("background-position-y", "-14px");
			$(".zj_cx_suv").css("background-position-y", "-14px");
			$(".zj_cx_zsw").css("background-position-y", "-14px");
			$(".zj_cx_gx").css("background-position-y", "-14px");
			$(".zj_cx_dd").css("background-position-y", "-14px");
			$(".zj_cx_sdjc").css("background-position-y", "-14px");
			$(".zj_cx_jj").css("background-position-y", "-14px");
			$(".zj_cx_sw").css("background-position-y", "-14px");
			$(".pointer i.cartxt").css("color", "#93939e");
			$(".check i.cartxt").css("color", "#93939e");
			$(".zj_cx_hh").next().css("color", "#fabe00");
			type="豪华型";
			break;
		case 5:
			$(".zj_cx_suv").css("background-position-y", "-41px");
			$(".zj_cx_bx").css("background-position-y", "-14px");
			$(".zj_cx_sdjc").css("background-position-y", "-14px");
			$(".zj_cx_jj").css("background-position-y", "-14px");
			$(".zj_cx_sw").css("background-position-y", "-14px");
			$(".zj_cx_hh").css("background-position-y", "-14px");
			$(".zj_cx_zsw").css("background-position-y", "-14px");
			$(".zj_cx_gx").css("background-position-y", "-14px");
			$(".zj_cx_dd").css("background-position-y", "-14px");
			$(".pointer i.cartxt").css("color", "#93939e");
			$(".check i.cartxt").css("color", "#93939e");
			$(".zj_cx_suv").next().css("color", "#fabe00");
			type="SUV";
			break;
		case 6:
			$(".zj_cx_zsw").css("background-position-y", "-41px");
			$(".zj_cx_bx").css("background-position-y", "-14px");
			$(".zj_cx_gx").css("background-position-y", "-14px");
			$(".zj_cx_dd").css("background-position-y", "-14px");
			$(".zj_cx_sdjc").css("background-position-y", "-14px");
			$(".zj_cx_jj").css("background-position-y", "-14px");
			$(".zj_cx_sw").css("background-position-y", "-14px");
			$(".zj_cx_hh").css("background-position-y", "-14px");
			$(".zj_cx_suv").css("background-position-y", "-14px");
			$(".pointer i.cartxt").css("color", "#93939e");
			$(".check i.cartxt").css("color", "#93939e");
			$(".zj_cx_zsw").next().css("color", "#fabe00");
			type="6至15座商务";
			break;
		case 7:
			$(".zj_cx_gx").css("background-position-y", "-41px");
			$(".zj_cx_bx").css("background-position-y", "-14px");
			$(".zj_cx_sdjc").css("background-position-y", "-14px");
			$(".zj_cx_jj").css("background-position-y", "-14px");
			$(".zj_cx_sw").css("background-position-y", "-14px");
			$(".zj_cx_hh").css("background-position-y", "-14px");
			$(".zj_cx_suv").css("background-position-y", "-14px");
			$(".zj_cx_zsw").css("background-position-y", "-14px");
			$(".zj_cx_dd").css("background-position-y", "-14px");
			$(".pointer i.cartxt").css("color", "#93939e");
			$(".check i.cartxt").css("color", "#93939e");
			$(".zj_cx_gx").next().css("color", "#fabe00");
			type="个性车";
			break;
		case 8:
			$(".zj_cx_dd").css("background-position-y", "-41px");
			$(".zj_cx_bx").css("background-position-y", "-14px");
			$(".zj_cx_sdjc").css("background-position-y", "-14px");
			$(".zj_cx_jj").css("background-position-y", "-14px");
			$(".zj_cx_sw").css("background-position-y", "-14px");
			$(".zj_cx_hh").css("background-position-y", "-14px");
			$(".zj_cx_suv").css("background-position-y", "-14px");
			$(".zj_cx_zsw").css("background-position-y", "-14px");
			$(".zj_cx_gx").css("background-position-y", "-14px");
			$(".pointer i.cartxt").css("color", "#93939e");
			$(".check i.cartxt").css("color", "#93939e");
			$(".zj_cx_dd").next().css("color", "#fabe00");
			type="电动车";
			break;
	}

}

function jia(jia) {
	var num = $(jia).index();
	switch (num) {
		case 0:
			$("#bar1").css("background", "#fabe00");
			$("#pri1").css("color", "#fabe00");
			$("#bar2").css("background", "#e9ebee");
			$("#bar3").css("background", "#e9ebee");
			$("#bar4").css("background", "#e9ebee");
			$("#bar5").css("background", "#e9ebee");
			$("#pri2").css("color", "#e9ebee");
			$("#pri3").css("color", "#e9ebee");
			$("#pri4").css("color", "#e9ebee");
			$("#pri5").css("color", "#e9ebee");
			$("#pri6").css("color", "#e9ebee");
			price=0.0;
			price2=99999.0;
			break;
		case 1:
			$("#bar2").css("background", "#fabe00");
			$("#pri2").css("color", "#fabe00");
			$("#pri3").css("color", "#fabe00");
			$("#bar1").css("background", "#e9ebee");
			$("#bar3").css("background", "#e9ebee");
			$("#bar4").css("background", "#e9ebee");
			$("#bar5").css("background", "#e9ebee");
			$("#pri1").css("color", "#e9ebee");
			$("#pri4").css("color", "#e9ebee");
			$("#pri5").css("color", "#e9ebee");
			$("#pri6").css("color", "#e9ebee");
			price=0.0;
			price2=150;
			break;
		case 2:
			$("#bar3").css("background", "#fabe00");
			$("#pri3").css("color", "#fabe00");
			$("#pri4").css("color", "#fabe00");
			$("#bar1").css("background", "#e9ebee");
			$("#bar2").css("background", "#e9ebee");
			$("#bar4").css("background", "#e9ebee");
			$("#bar5").css("background", "#e9ebee");
			$("#pri1").css("color", "#e9ebee");
			$("#pri2").css("color", "#e9ebee");
			$("#pri5").css("color", "#e9ebee");
			$("#pri6").css("color", "#e9ebee");
			price=150;
			price2=300;
			break;
		case 3:
			$("#bar4").css("background", "#fabe00");
			$("#pri4").css("color", "#fabe00");
			$("#pri5").css("color", "#fabe00");
			$("#bar1").css("background", "#e9ebee");
			$("#bar2").css("background", "#e9ebee");
			$("#bar3").css("background", "#e9ebee");
			$("#bar5").css("background", "#e9ebee");
			$("#pri1").css("color", "#e9ebee");
			$("#pri2").css("color", "#e9ebee");
			$("#pri3").css("color", "#e9ebee");
			$("#pri6").css("color", "#e9ebee");
			price=300;
			price2=500;
			break;
		case 4:
			$("#bar5").css("background", "#fabe00");
			$("#pri5").css("color", "#fabe00");
			$("#pri6").css("color", "#fabe00");
			$("#bar1").css("background", "#e9ebee");
			$("#bar2").css("background", "#e9ebee");
			$("#bar3").css("background", "#e9ebee");
			$("#bar4").css("background", "#e9ebee");
			$("#pri1").css("color", "#e9ebee");
			$("#pri2").css("color", "#e9ebee");
			$("#pri3").css("color", "#e9ebee");
			$("#pri4").css("color", "#e9ebee");
			price=500;
			price2=99999.0;
			break;
	}
}


function pai(id) {
	var num = $("#"+id).index();
	if (num != 0) {
		$(".car_brand li").children().css("color", "#93939e");
		$("#"+id).children().css("color", "#fabe00");
		pin = $("#"+id).children().text();
		$("#bx").css("color", "#93939e");
	}
	if (num == 0) {
		$(".car_brand li").children().css("color", "#93939e");
		$("#bx").css("color", "#fabe00");
		pin = "";
		i = 0;
	}
}

function changeOrderType(id){
	$(".right_tab li.cur").removeClass("cur");
	$("#"+id).addClass("cur");
	if(id=='short'){
		time="短租";
	}else if(id=='week'){
		time="周租";
	}else if(id=='month'){
		time="月租";
	}else if(id=='year'){
		time="年租";
	}
}

function page(page){
	if(page=='first'){
		status="首页";
		currpage=1;
	}else if(page=='last'){
		status="上一页";
		currpage=currpage-1;
	}else if(page=='next'){
		status = "下一页";
		currpage=currpage+1;
	}else if(page=='end'){
		status = "尾页";	
		currpage=20;
	}
}

function getCar(){
	$.ajax({
		type:"get",
		url:"getcar",
		data:"type="+type+"&price="+price+"&price2="+price2+"&pin="+pin+"&time="+time+"&status="+status+"&currpage="+currpage+"&pagesize="+pagesize+"",
		success:function(e){
			$(".clist_tb tbody").html("");
			$(".clist_tb tbody").html(e);
		}
	});
}